package com.example.lib_common.mvi

import androidx.lifecycle.ViewModel
import com.example.lib_common.mvi.state.MutableContainer
import com.example.lib_common.mvi.state.RealContainer
import com.example.lib_common.mvi.state.UiState

abstract class BaseViewModel<REPO : BaseRepository,STATE : UiState> : ViewModel() {
    protected lateinit var repo : REPO
    private var state : STATE = createState()
    private var _mutableContainer : MutableContainer<STATE> = RealContainer(state)
    var mutableContainer: MutableContainer<STATE> = _mutableContainer
    abstract fun createRepo():REPO
    abstract fun createState():STATE
    init {
        repo = createRepo()
    }
}